package com.idp.web.dao;

import com.idp.common.base.BaseDao;
import com.idp.web.dto.DepartmentListDTO;
import com.idp.web.dto.DepartmentSelectListDTO;
import com.idp.web.dto.DepartmentTreeDTO;
import com.idp.web.entity.Department;
import com.idp.web.vo.DepartmentSearchVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 医院科室dao接口
 *
 * @author xubinren
 * @version 1.0
 * @date 2018/2/28
 */
public interface DepartmentDao extends BaseDao<Department, String> {

    /**
     * 根据父id查询对应的科室列表信息
     *
     * @param parentId 父id
     * @return List<DepartmentListDTO>
     */
    List<DepartmentListDTO> findForTreeTable(@Param(value = "parentId") String parentId);

    /**
     * 查询对应的科室列表信息
     *
     * @param departmentSearchVo 查询条件
     * @return List<DepartmentListDTO>
     */
    List<DepartmentListDTO> findTreeTableForHospital(DepartmentSearchVo departmentSearchVo);

    /**
     * 全科室信息查询
     *
     * @param department 查询条件
     * @return List<DepartmentTreeDTO>
     */
    List<DepartmentTreeDTO> selectAll(DepartmentSearchVo department);

    /**
     * 根据权重查询科室列表
     *
     * @param weight 权重
     * @param hospitalId 医院id
     * @return List<DepartmentSelectListDTO>
     */
    List<DepartmentSelectListDTO> selectListByWeight(@Param(value = "weight") int weight,@Param(value = "hospitalId") String hospitalId);

    /**
     * 根据科室名称查询对应的科室信息
     *
     * @param departmentName 科室名称
     * @return Department
     */
    Department getByName(@Param(value = "departmentName") String departmentName);

    /**
     * 查询科室的统计信息
     *
     * @param type 科室权重：1，一级科室；2，二级科室
     * @param hospitalId 医院id
     * @return Department
     */
    Integer queryStatistics(@Param(value = "type") int type, @Param(value = "hospitalId") String hospitalId);

    /**
     * 查询父id下的科室排序最大值
     *
     * @param parentId 父id
     * @return Integer
     */
    Integer getDefaultSort(@Param(value = "parentId") String parentId);
}